package io.renren.modules.app.service.impl;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import io.renren.common.utils.DateUtils;
import io.renren.modules.app.service.H5payService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import io.renren.common.utils.StringUtil;
import io.renren.modules.app.service.DayEndSettleService;

@Slf4j
@Service
public class DayEndSettleServiceImpl implements DayEndSettleService {

    @Autowired
    H5payService h5payService;

    /**
     * @param dateStr yyyyMMdd
     */
    @Override
    public boolean DayOfEndSettle(String dateStr) {
        log.debug("定时任务启动:" + dateStr);
        if (StringUtil.isEmpty(dateStr)) {
//            DateFormat df = new SimpleDateFormat("yyyyMMdd");
//            Calendar calendar = Calendar.getInstance();
//            dateStr = df.format(calendar.getTime());
            Date date1 = DateUtils.addDateDays(new Date(), -1);
            dateStr = DateUtils.format(date1, "yyyyMMdd");
            //return h5payService.jhdzQuery(dateStr); 
        }

        //TODO.........

        return h5payService.jhdzQuery(dateStr);
    }

}
